<div class="page-sidebar nav-collapse collapse">
	<ul class="page-sidebar-menu" id="myMenu">
	</ul>
</div>

<script src="${path }/static/js/template.js" type="text/javascript"></script>
<script id="menu" type="text/html">
<li>
			<div class="sidebar-toggler hidden-phone"></div>
		</li>
			<li class="start ${(home=='首页')?string('active','')}">
					<a href="/index">
					<i class="icon-home"></i> 
					<span class="title">首页</span>
					<span class="${(home=='首页')?string('selected','')}"></span>
					</a>

				</li>
			{{each data as resource}}
				{{if (resource.pid==0)}}
					<#-- 一层目录选中样式Start-->
					{{if (resource.name=='${firMenu!''}')}}
					<li class="active">
					{{else}}
					<li >
					{{/if}}
						<a href="javascript:;"> <i class="{{resource.icon }}"></i>
							<span class="title">{{resource.name }}</span> 
					{{if (resource.name=='${firMenu!''}')}}
					<span class="selected"></span>
					{{else}}
					<span class="arrow "></span>
					{{/if}}
							
						</a>
					<#-- 一层目录选中样式End-->
					<ul class="sub-menu">
					{{each data as c_permission}}	
						{{if (c_permission.pid==resource.id)}}
							<#--二层目录选中Start -->
							{{if (c_permission.name=='${secMenu!''}')}}
								<li class="active">
							{{else}}
								<li >
							{{/if}}
						<#--二层目录选中End -->
								<a href="{{c_permission.url }}">
								<i class="{{c_permission.icon }}"></i>
						{{c_permission.name}}</a></li>
						{{/if}}	
					{{/each}}
				</ul></li>
				{{/if}}	
			{{/each}}
			</script>
<script type="text/javascript">
	$(function() {
		$.ajax({
			async : false,
			type : 'get',
			url : "${path }/resources/currentResources.json",
			success : function(data) {
				var menuData = {
					data : data
				};
				var html = template('menu', menuData);
				$('#myMenu').html(html);
			}
		});
	});
</script>